//
//  YouLovedCollectionViewCell.m
//  Youhuiju
//
//  Created by yutenys on 16/7/27.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "YouLovedCollectionViewCell.h"

@interface YouLovedCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *goodsImg;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceImg;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIButton *typeBtn;




//适配
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *goodsImgWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *goodsImgHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *goodsImgTop;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelTop;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *priceLabelHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *priceLabelTop;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyBtnHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyBtnWidth;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeBtnWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeBtnHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeBtnTop;
@end


@implementation YouLovedCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.goodsImgWidth.constant = 66 * FitW;
     self.goodsImgHeight.constant = 75 * FitH;
     self.goodsImgTop.constant = 10 * FitH;
    
    self.titleLabelTop.constant = 10 * FitH;
    
    self.priceLabelHeight.constant = 8 * FitH;
    self.priceLabelTop.constant = 10 * FitH;
    
    self.buyBtnWidth.constant = 21 * FitW;
    self.buyBtnHeight.constant = 19 * FitH;
    
    self.typeBtnWidth.constant = 88 * FitW;
    self.typeBtnHeight.constant = 21 * FitH;
    
    self.typeBtnTop.constant = 9 * FitH;
    
    self.titleLabel.font = [UIFont systemFontOfSize:12 * FitH];
    self.priceImg.font = [UIFont systemFontOfSize:10 * FitH];
    self.priceLabel.font = [UIFont systemFontOfSize:10 * FitH];
    
    self.typeBtn.layer.borderWidth = 1.0f * FitH;
    self.typeBtn.layer.borderColor = [UIColor colorWithHexString:@"d2d2d2"].CGColor;
    self.typeBtn.layer.cornerRadius = 3 * FitH;
    
//        CAGradientLayer *gradientLayer = [CAGradientLayer layer];  // 设置渐变效果
//        gradientLayer.bounds = self.bounds;
//        gradientLayer.borderWidth = 0;
//    
//        gradientLayer.frame = self.typeBtn.frame;
//        gradientLayer.colors = [NSArray arrayWithObjects:
//                                (id)[[UIColor colorWithHexString:@"ff9a64"] CGColor],
//                                (id)[[UIColor colorWithHexString:@"fc4980"] CGColor], nil ];
//    
//        gradientLayer.startPoint = CGPointMake(1, 0);
//        gradientLayer.endPoint = CGPointMake(0, 1);
//    
//        [self.typeBtn.layer insertSublayer:gradientLayer atIndex:0];

}

- (IBAction)buttonClickedAction:(UIButton *)sender {
    [self.buttonDelegate buttonClickedJump:sender.tag :sender.titleLabel.text];
}

@end
